package com.punch.common.enums.course;

/**
 * @author xiaol
 * @date 2020/7/21 15:53
 * 班级状态枚举
 */

public enum ClassStatusEnum {
    TO_APPLY(0, "待申请"),
    TO_RELEASE(1, "待发布"),
    TO_SIGN(2, "待报名"),
    SIGN_IN(3, "报名中"),
    TO_OPEN_CLASS(4, "待开班"),
    OPEN_CLASS(5, "已开班"),
    FINISH_CLASS(6, "已完成"),
    REFUSE(7, "已拒绝"),
    OPEN_CLASS_FAIL(8, "开班失败");

    ClassStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    private int code;
    private String name;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static String getName(Integer code) {
        if (code == null) {
            return "";
        }
        for (ClassStatusEnum roleEnum : ClassStatusEnum.values()) {
            if (roleEnum.getCode() == code) {
                return roleEnum.getName();
            }
        }
        return "";
    }
}

